/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fbv.tcc.utils;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Properties;
import javax.swing.JTextField;

/**
 *
 * @author Victor
 */
public class PropertiesGenerator {

    public static void salvarProperties(String caminhoGrafico, String caminhoPlanilha, String colunaData, String colunaRadiacao, String deslocamento, String latitude, String longitude, String latitudeOficial) throws FileNotFoundException, IOException {
        Properties properties = new Properties();
        properties.setProperty("caminhoGrafico", caminhoGrafico);
        properties.setProperty("caminho", caminhoPlanilha);
        properties.setProperty("colunaData", colunaData);
        properties.setProperty("colunaRadiacao", colunaRadiacao);
        properties.setProperty("deslocamento",deslocamento);
        properties.setProperty("latitude",latitude);
        properties.setProperty("longitude", longitude);
        properties.setProperty("latitudeOficialLocalidade", latitudeOficial);

        File file = new File("data.properties");
        FileOutputStream fileOut = new FileOutputStream(file);
        properties.store(fileOut, "PIG2");
        fileOut.close();
    }

    public static Properties carregarProperties() throws FileNotFoundException, IOException {
        File file = new File("data.properties");
        FileInputStream fileInput = new FileInputStream(file);
        Properties properties = new Properties();
        properties.load(fileInput);
        fileInput.close();
    
        return properties;
    }
}
